<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>处理资源配置审批</title>
	<%@ include file="/WEB-INF/include/include.jsp" %>
	<script type="text/javascript" src="<%=path %>/js/rms/auditconfig/auditConfigEdit.js"></script>
  </head>
  <body>
	<div class="editpage-locked-content">
		<h2 class="editpage-lk-title" >处理资源配置审批:<script type="text/javascript">document.write(AuditConfigEdit.objName)</script></h2>		
		<div class="editpage-lk-tbar" id="tbarWrap"></div>
	</div>
	<div class="editpage-content" >
		<div class="editpage-form" id="formWrap"></div>
		<div id="hostGridWrap"></div>
		<div id="lastResGridWrap"></div>
		<div id="gttFormWrap"></div>
		
		<div id="auditFormWrap"></div>
		<div id="auditLogGridWrap"></div>
	</div>
	
  </body>
</html>

	<ui:page>
	
	<ui:toolbar  id="toolbar"  renderTo="tbarWrap" >
		<x:items>
			<ui:button text="保存" iconCls='icon-save'  handler="AuditConfigEdit.submitForm" scope="AuditConfigEdit"   />
			<x:value>-</x:value>
			<ui:button text="提交" iconCls='icon-apply'  handler="AuditConfigEdit.submitApply" scope="AuditConfigEdit"   />
			<x:value>-</x:value>			
			<ui:button text="取消" iconCls='icon-cancel' handler="AuditConfigEdit.close" scope="AuditConfigEdit" />
			<x:value>-</x:value>
		</x:items>
	</ui:toolbar>

	<ui:formPanel id="resApplyForm" width="700" renderTo="formWrap">
		<x:attr name="border" type="int" >0</x:attr>
		<x:attr name="bodyPadding"  type="int" >5</x:attr>
		<x:attr name="fieldDefaults">
			<x:value>
				<x:attr name="labelAlign"  type="string" >right</x:attr>
			</x:value>
		</x:attr>
		<x:items>
			<x:value>
				<x:attr name="padding" type="string">2</x:attr>
				<x:attr name="layout">column</x:attr>
				<x:attr name="border" type="int" >0</x:attr>
				<x:attr name="items" type="array">
					<ui:formPanel.text  id="resName" fieldLabel="项目名称" allowBlank="false" readOnly="true" width="510" config="true"   />
				</x:attr>
			</x:value>	
			<x:value>
				<x:attr name="padding" type="string">2</x:attr>
				<x:attr name="layout">column</x:attr>
				<x:attr name="border" type="int" >0</x:attr>
				<x:attr name="items" type="array">
					<ui:formPanel.text  id="eName" fieldLabel="英文名称" allowBlank="false" readOnly="true" config="true"   />
				</x:attr>
			</x:value>	
			<x:value>
				<x:attr name="padding" type="string">2</x:attr>
				<x:attr name="layout">column</x:attr>
				<x:attr name="border" type="int" >0</x:attr>
				<x:attr name="items" type="array">
					<ui:formPanel.date id="startDate"  fieldLabel="开始时间" allowBlank="false" readOnly="true" config="true" ></ui:formPanel.date>
					<ui:formPanel.date id="endDate" fieldLabel="结束时间" allowBlank="false" readOnly="true" config="true" ></ui:formPanel.date>
					<ui:button text="查看该时段资源使用情况" handler="AuditConfigEdit.queryRes" ></ui:button>
				</x:attr>
			</x:value>			
			<x:value>
				<x:attr name="padding" type="string">2</x:attr>
				<x:attr name="layout">column</x:attr>
				<x:attr name="border" type="int" >0</x:attr>
				<x:attr name="items" type="array">
					<ui:formPanel.text  id="user_name" fieldLabel="申请人" allowBlank="false" readOnly="true" config="true"   />
					<ui:formPanel.text  id="endTime" fieldLabel="申请时间" allowBlank="false" readOnly="true" config="true"   />
				</x:attr>
			</x:value>			
			
			<x:value>
				<x:attr name="padding" type="string">2</x:attr>
				<x:attr name="layout">column</x:attr>
				<x:attr name="border" type="int" >0</x:attr>
				<x:attr name="items" type="array">
					<ui:formPanel.textarea id="resDesc" fieldLabel="项目描述" readOnly="true" config="true" width="510"  />		
					<ui:formPanel.hidden id="applyId" config="true" />
					<ui:formPanel.hidden id="authorId" config="true" />
				</x:attr>
			</x:value>
		</x:items>
	</ui:formPanel>

  	<ui:model name="GridHostConfigModel">
  		 <x:attr name="fields" type="array">
  			<ui:model.field name="configId"   ></ui:model.field>
  			<ui:model.field name="applyId"   ></ui:model.field>
  			<ui:model.field name="hostDesc"   ></ui:model.field>
  			<ui:model.field name="opsSeries"   ></ui:model.field>
  			<ui:model.field name="opsName"   ></ui:model.field>
  			<ui:model.field name="cups"   ></ui:model.field>
  			<ui:model.field name="memory"   ></ui:model.field>
  			<ui:model.field name="memoryunit"   ></ui:model.field>
  			<ui:model.field name="storage"   ></ui:model.field>
  			<ui:model.field name="storageunit"   ></ui:model.field>
  			<ui:model.field name="netcards"   ></ui:model.field>
  			<ui:model.field name="hostName"   ></ui:model.field>
  			<ui:model.field name="hostIp"   ></ui:model.field>
  			
  		</x:attr>
  	</ui:model>
	
 	<ui:toolbar var="hostToolbar" >
 		<x:items>
 			<ui:button text="编辑" iconCls='icon-edit'  handler="AuditConfigEdit.editHostConfig" scope="AuditConfigEdit"   />
  		</x:items>
 	</ui:toolbar>
	
	<ui:grid id="hostConfigGrid" model="GridHostConfigModel" datasetName="ResApplyDataSetHandler" showCheckbox="true" showPaging="false"
		handlerName="ResApplyQueryHandler" autoLoad="false" title="申请主机列表"
		renderTo="hostGridWrap"	>
		<x:attr name="tbar" type="direct" >hostToolbar</x:attr>
		<x:columns>
			<ui:gridcolumn dataIndex="hostName"  text="主机名" ></ui:gridcolumn>	
			<ui:gridcolumn dataIndex="hostIp"  text="主机IP" ></ui:gridcolumn>		
			<ui:gridcolumn dataIndex="configId" hidden="true" ></ui:gridcolumn>
			<ui:gridcolumn dataIndex="applyId" hidden="true" ></ui:gridcolumn>
			<ui:gridcolumn dataIndex="opsName"  text="操作系统" renderer="AuditConfigEdit.renderGrid"></ui:gridcolumn>
			<ui:gridcolumn dataIndex="cups" text="CPU个数"  ></ui:gridcolumn>
			<ui:gridcolumn dataIndex="memory" text="内存大小"  renderer="AuditConfigEdit.renderGrid"></ui:gridcolumn>
			<ui:gridcolumn dataIndex="storage"  text="硬盘大小" renderer="AuditConfigEdit.renderGrid"></ui:gridcolumn>
			<ui:gridcolumn dataIndex="netcards"  text="网卡个数" ></ui:gridcolumn>
			<ui:gridcolumn dataIndex="hostDesc"  text="描述" ></ui:gridcolumn>
		</x:columns>
		<x:listeners>
			<x:handler name="itemclick" funcName="AuditConfigEdit.fillHostForm"></x:handler>
		</x:listeners>
		
	</ui:grid>
	
	
	<ui:window id="resqueyWin" width="820" height="500" title="资源使用情况" >
		<x:attr name="layout" type="string">border</x:attr>
		<x:attr name="closeAction">hide</x:attr>
		<x:items>
			<ui:panel id="gttform" >
				<x:attr name="border" type="int" >0</x:attr>
				<x:attr name="bodyPadding"  type="int" >5</x:attr>
				<x:attr name="html" type="html"><iframe id="framegtt" src="" style="width:810px;height:450px"  />   </x:attr>
			</ui:panel>	
		</x:items>
	</ui:window>
	 
	 <ui:formPanel id="auditForm" renderTo="auditFormWrap" title="审批" >
	 	<x:attr name="border" type="int" >0</x:attr>
		<x:attr name="bodyPadding"  type="int" >5</x:attr>
		<x:attr name="fieldDefaults">
			<x:value>
				<x:attr name="labelAlign"  type="string" >right</x:attr>
			</x:value>
		</x:attr>
	 	<x:items>
	 		<ui:formPanel.comboxstatic fieldLabel="审批结果" id="auditResult" allowBlank="false" data="[['0','审批不通过'],['1','审批通过']]" >
	 			<x:listeners>
	 				<x:handler name="change" funcName="AuditConfigEdit.onchange"></x:handler>
	 			</x:listeners>
	 		</ui:formPanel.comboxstatic>
	 		<ui:formPanel.textarea fieldLabel="审批意见" id="auditOpinion" allowBlank="false" width="510" ></ui:formPanel.textarea>
	 	</x:items>
	 </ui:formPanel>	
	  
  	<ui:model name="GridAuditLogModel">
  		 <x:attr name="fields" type="array">
  			<ui:model.field name="stepName"   ></ui:model.field>
  			<ui:model.field name="user_name"   ></ui:model.field>
  			<ui:model.field name="endTime"   ></ui:model.field>
  			<ui:model.field name="opinion"   ></ui:model.field>
  			<ui:model.field name="result"   ></ui:model.field>
  		</x:attr>
  	</ui:model>	
	<ui:grid id="auditLogGrid" model="GridAuditLogModel" title="审批记录"
		datasetName="ResApplyDataSetHandler" showPaging="false" autoLoad="false"
		handlerMethod="queryAudtiLogGrid"
		handlerName="ResApplyQueryHandler"  
		renderTo="auditLogGridWrap"	>
		<x:columns>
			<ui:gridcolumn dataIndex="stepName"  text="审批步骤" ></ui:gridcolumn>
			<ui:gridcolumn dataIndex="user_name" text="审批人"  ></ui:gridcolumn>
			<ui:gridcolumn dataIndex="endTime" text="审批时间" width="130"  ></ui:gridcolumn>
			<ui:gridcolumn dataIndex="opinion"  text="审批意见" width="200" ></ui:gridcolumn>
			<ui:gridcolumn dataIndex="result"  text="审批结果" renderer="AuditConfigEdit.renderAuditGrid" ></ui:gridcolumn>
		</x:columns>
	</ui:grid>
		 
	 <ui:window id="resqueyWin" width="710" height="510" title="资源使用情况" >
		<x:attr name="layout" type="string">border</x:attr>
		<x:attr name="closeAction">hide</x:attr>
		<x:items>
			<ui:panel id="gttform" >
				<x:attr name="border" type="int" >0</x:attr>
				<x:attr name="bodyPadding"  type="int" >5</x:attr>
				<x:attr name="html" type="html"><iframe id="framegtt" src="" style="width:700px;height:500px"  />   </x:attr>
			</ui:panel>	
		</x:items>
	</ui:window>
	
	<ui:window  id="hostConfigWin"  width="500" height="350" title="添加主机">
		<x:attr name="layout" type="string">border</x:attr>
		<x:attr name="closeAction">hide</x:attr>
		<x:items>
			<ui:formPanel id="hostForm"  >
				<x:attr name="region" type="string">center</x:attr>
				<x:attr name="fieldDefaults">
					<x:value>
						<x:attr name="labelAlign"  type="string" >right</x:attr>
						<x:attr name="width"  type="int" >400</x:attr>
					</x:value>
				</x:attr>
				<x:items>
					<ui:formPanel.text  id="configId"  config="true"  hidden="true"  />
					<x:value>
						<x:attr name="padding" type="string">2</x:attr>
						<x:attr name="layout">column</x:attr>
						<x:attr name="border" type="int" >0</x:attr>
						<x:attr name="items" type="array">
							<ui:formPanel.text id="hostName" fieldLabel="主机名" allowBlank="false" config="true"></ui:formPanel.text>
						</x:attr>
					</x:value>
					<x:value>
						<x:attr name="padding" type="string">2</x:attr>
						<x:attr name="layout">column</x:attr>
						<x:attr name="border" type="int" >0</x:attr>
						<x:attr name="items" type="array">
							<ui:formPanel.text id="hostIp" fieldLabel="主机IP"  config="true"></ui:formPanel.text>
						</x:attr>
					</x:value>
					<x:value>
						<x:attr name="padding" type="string">2</x:attr>
						<x:attr name="layout">column</x:attr>
						<x:attr name="border" type="int" >0</x:attr>
						<x:attr name="items" type="array">
							<ui:formPanel.comboxstatic id="opsSeries" fieldLabel="操作系统系列" allowBlank="false"  readOnly="true" data="[['0','Windows'],['1','Linux']]" config="true"  hidden="true"  value="0"></ui:formPanel.comboxstatic>
						</x:attr>
					</x:value>				
					<x:value>
						<x:attr name="padding" type="string">2</x:attr>
						<x:attr name="layout">column</x:attr>
						<x:attr name="border" type="int" >0</x:attr>
						<x:attr name="items" type="array">
							<ui:formPanel.comboxstatic id="opsName" fieldLabel="操作系统" allowBlank="false" readOnly="true" data="[['XP_TPL','Window XP'],['WIN7_TPL','Window 7'],['LINUX_TPL','LINUX']]" config="true"></ui:formPanel.comboxstatic>
						</x:attr>
					</x:value> 
					<x:value>
						<x:attr name="padding" type="string">2</x:attr>
						<x:attr name="layout">column</x:attr>
						<x:attr name="border" type="int" >0</x:attr>
						<x:attr name="items" type="array">
						<ui:formPanel.number id="cups" fieldLabel="CPU个数"  config="true" allowBlank="false" readOnly="true" width="200" ></ui:formPanel.number>
						<ui:formPanel.number id="netcards" fieldLabel="网卡个数"  config="true" allowBlank="false" readOnly="true" width="200"></ui:formPanel.number>
						</x:attr>
					</x:value>				
					<x:value>
						<x:attr name="padding" type="string">2</x:attr>
						<x:attr name="layout">column</x:attr>
						<x:attr name="border" type="int" >0</x:attr>
						<x:attr name="items" type="array">
							<ui:formPanel.number id="memory" fieldLabel="内存大小"  allowBlank="false" config="true" readOnly="true" width="200" ></ui:formPanel.number>
							<ui:formPanel.comboxstatic id="fmemoryunit" fieldLabel="单位" allowBlank="false" readOnly="true" data="[['0','MB'],['1','GB']]" width="200"  config="true">
							</ui:formPanel.comboxstatic>
						</x:attr>
					</x:value>					
					<x:value>
						<x:attr name="padding" type="string">2</x:attr>
						<x:attr name="layout">column</x:attr>
						<x:attr name="border" type="int" >0</x:attr>
						<x:attr name="items" type="array">
							<ui:formPanel.number id="storage" fieldLabel="硬盘大小"  allowBlank="false" config="true" readOnly="true" width="200"  ></ui:formPanel.number>
							<ui:formPanel.comboxstatic id="fstorageunit" fieldLabel="单位" allowBlank="false" readOnly="true" data="[['0','MB'],['1','GB'],['2','TB']]"  width="200"  config="true">
							</ui:formPanel.comboxstatic>
						</x:attr>
					</x:value>					

					<x:value>
						<x:attr name="padding" type="string">2</x:attr>
						<x:attr name="layout">column</x:attr>
						<x:attr name="border" type="int" >0</x:attr>
						<x:attr name="items" type="array">
							<ui:formPanel.textarea id="hostDesc" fieldLabel="主机描述"  readOnly="true" config="true"></ui:formPanel.textarea>
						</x:attr>
					</x:value>					
				</x:items>
			</ui:formPanel>
		</x:items>
		<x:attr name="buttons">
			<x:array>
				<ui:button text="确定" handler="AuditConfigEdit.addHost" />
				<ui:button text="取消" handler="AuditConfigEdit.closeHostWin"/>
			</x:array>
		</x:attr>
	</ui:window>
	
	
	
	
	
	<x:bottomScript>
		AuditConfigEdit.loadForm();
	</x:bottomScript>
	
	</ui:page>

	
